import store from "@/store/index";
import * as types from '@/store/mutations-types';
import {getToken, getUserId} from '@/common/js/cookie'

export function isLogin() {
  let token = store.getters.token;
  if (!token) {
    token = getToken();
    if(token) {
      let userId = getUserId();
      store.commit(types.SET_TOKEN,token);
      store.commit(types.SET_USER_ID,userId);
      return true;
    }
    return false;
  }
  return true;
}